<template>
  <div>
    <el-dialog title="选择抵押银行" v-model="editVisible" width="50%" top="5vh" :close-on-click-modal="false"
      @close="handleclose">
      <el-form>
        <el-form-item>
          <div v-for="(item, index) in bankList" :key="index">
            <div class="displayflex align-items border_bottom padding20 cursorp listbox" @click="handleSaveEdit">
              <img class="banklogo" :src="item.logo" />
              <span class="marginleft30">{{ item.name }}</span>
            </div>
          </div>
        </el-form-item>
        <!-- <el-form-item :required="true">
          <div class="btn_b displayflex justify-content margintop30">
            <el-button @click="handleclose" class="icon-search1"
              >取消</el-button
            >
            <el-button type="primary" class="icon-search" @click="handleclose"
              >提交</el-button
            >
          </div>
        </el-form-item> -->
      </el-form>
      <template #footer> </template>
    </el-dialog>
  </div>
</template>
<script>
import { ref, reactive } from "vue";
import { useRoute, useRouter } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus";
import api from "../api/api";
export default {
  components: {},
  setup(props, context) {
    console.log(context);
    // 参考图片
    const editVisible = ref(context.attrs.editVisible);
    const radioValue = ref(context.attrs.radioValue);
    const Refused = reactive({
      reason: "",
      remark: "",
    });
    const router = useRouter();
    const handleclose = () => {
      editVisible.value = false;
      // ElMessage.success("抵押成功！");
      context.emit("handleclose", editVisible.value);
    };
    //图片上传
    const uploaddata = ref({});
    const handleUpload = () => {
      uploaddata.value = {
        url: api.getUrl() + "auth/file/upload", //接口名称
        data: {
          upType: "fc",
          sort: Math.floor(Math.random() * 20) + 1,
        },
        headers: {
          token: localStorage.getItem("token"),
          Authorization: "Bearer " + localStorage.getItem("token"),
        },
      };
    };
    const handleSaveEdit = () => {
      editVisible.value = false;
      ElMessage.success("抵押成功！");
      context.emit("handleSaveEdit");
    };
    return {
      List: [
        {
          paramName: "低碳会议",
        },
        {
          paramName: "低碳建团",
        },
      ],
      bankList: [
        { name: "中国银行", logo: "../src1/assets/img/bank/zgyh.png" },
        { name: "中国建设银行", logo: "../src1/assets/img/bank/zgjs.png" },
        { name: "中国工商银行", logo: "../src1/assets/img/bank/zggs.png" },
        { name: "中国兴业银行", logo: "../src1/assets/img/bank/xyyh.png" },
        { name: "中国农业发展银行", logo: "../src1/assets/img/bank/zgnyfzyh.png" },
        { name: "中国农业银行", logo: "../src1/assets/img/bank/zgnyyh.png" },
        { name: "国家开发银行", logo: "../src1/assets/img/bank/gjkfyh.png" },
      ],
      router,
      radioValue,
      editVisible,
      uploaddata,
      Refused,
      handleclose,
      handleSaveEdit,
      handleUpload,
    };
  },
};
</script>

<style lang="less" scoped>
@import "../assets/css/common.css";

&:deep(.el-dialog) {
  background: #fff !important;
}

&:deep(.el-dialog__headerbtn .el-dialog__close) {
  color: #909399;
  background: #fff;
  width: 30px;
  height: 30px;
  border-radius: 360px;
  font-size: 30px;
}

&:deep(.el-form-item__content) {
  text-align: center;
}

.btn_b {
  padding: 30px;
}

.banklogo {
  height: 50px;
  width: 50px;
}
</style>
